package com.board.controller;


import com.board.entity.OrderDetail;
import com.board.service.OrderDetailService;
import com.board.util.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 膳食系统-订单详情表 前端控制器
 * </p>
 *
 * @author 小叶
 * @since 2024年04月04日
 */
@RestController
@RequestMapping("/orderDetail")
@Api(tags = "订单详情接口")
public class OrderDetailController {
    @Autowired
    private OrderDetailService orderDetailService;

    /**
     * 根据id查询订单详情数据
     * @param orderDetailId 查询的订单详情id
     * @return 返回查询的订单详情数据
     */
    @GetMapping("/findOrderDetailById")
    @ApiOperation("根据订单id查询订单详情")
    public Result findOrderDetailById(Integer orderDetailId){
        OrderDetail orderDetail= orderDetailService.findOrderDetailById(orderDetailId);
        return Result.success("查询成功",orderDetail);
    }

    @GetMapping("/findOrderDetailByOrderNum")
    @ApiOperation("根据订单编号查询订单详情")
    public Result findOrderDetailByOrderNum(String orderNum){
        List<OrderDetail> orderDetail= orderDetailService.findOrderDetailByOrderNum(orderNum);
        return Result.success("查询成功",orderDetail);
    }

}

